﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HZ.MBSM.DBUtility;
public partial class Agency_Company_xq : System.Web.UI.Page
{
    private Int64 AccountId;
    public string strTJZT;
    protected void Page_Load(object sender, EventArgs e)
    {
     
                AccountId = SysFun.ToInt(SysFun.IsSQL(Request.QueryString["AccountId_PS"]));
                if (!this.IsPostBack)
                {
                    HZ.MBSM.DBUtility.Db db = new HZ.MBSM.DBUtility.Db(false);
                    Grove.ORM.ObjectOperator oo = db.GetObjectOperator();

                    HZ.MBSM.Model.Company Company = (HZ.MBSM.Model.Company)oo.Retrieve(typeof(HZ.MBSM.Model.Company), AccountId);
                    HZ.MBSM.Model.Area Area = (HZ.MBSM.Model.Area)oo.Retrieve(typeof(HZ.MBSM.Model.Area), Company.AreaId);
                    if (Area != null)
                        this.Label1.Text = "<input  type='text' readonly name='AreaName'  NotNull='所属地区' style='width: 97px' value='" + Area.AreaName + "' /><input type='text' name='AreaId' style='display:none; width: 64px;' value='" + Company.AreaId + "'>";
                    else
                        this.Label1.Text = "<input  type='text' readonly name='AreaName'  NotNull='所属地区' style='width: 97px' /><input type='text' name='AreaId' style='display:none; width: 64px;' >";
                  
                   
                    Address.Text = SysFun.ToTrim(Company.Address);
                    RegistAddress.Text = SysFun.ToTrim(Company.RegistAddress);
                    CompanyName.Text = SysFun.ToTrim(Company.CompanyName) + "(" + Company.UserCode + ")";
                   
                    PostCode.Text = SysFun.ToTrim(Company.PostCode);
                    Fax.Text = SysFun.ToTrim(Company.Fax);
                    Telepone.Text = SysFun.ToTrim(Company.Telepone);
                    Lawer.Text = SysFun.ToTrim(Company.Lawer);
                    IDcard.Text = SysFun.ToTrim(Company.IDcard);
                    Fund.Text = SysFun.ToTrim(Company.Fund.ToString());
                    LastIncome.Text = SysFun.ToTrim(Company.LastIncome.ToString());
                   
                    Email.Text = SysFun.ToTrim(Company.Email);
                    Sort.SelectedValue = SysFun.ToTrim(Company.Sort);
                    Sort.Enabled = false;
                    Introduction.Text = SysFun.ToTrim(Company.Introduction);
                    if (Company.CodeDate > Convert.ToDateTime("1900-1-1"))
                        txtCodeDate.Text = Company.CodeDate.ToString();
                    txtNetAddress.Text = SysFun.ToTrim(Company.NetAddress);
                    txtCodeId.Text = SysFun.ToTrim(Company.CodeId);
                    txtFixFund.Text = SysFun.ToTrim(Company.FixFund);


                    if (Company.LCDate > Convert.ToDateTime("1900-1-1"))
                        txtLCDate.Text = Company.LCDate.ToString();

                    txtLCPermission.Text = SysFun.ToTrim(Company.LCPermission);
                    txtPermission.Text = SysFun.ToTrim(Company.Permission);
                    if (Company.PermissionDate > Convert.ToDateTime("1900-1-1"))
                        txtPermissionDate.Text = Company.PermissionDate.ToString();
                 
                    rdoLcLevel.SelectedValue = Company.LcLevel;
                    txtTotalFund.Text = SysFun.ToTrim(Company.TotalFund);
                    txtBusinessScope.Text = SysFun.ToTrim(Company.BusinessScope);
                    txtMemo1.Text = SysFun.ToTrim(Company.memo1);
                    txtWarrant.Text = SysFun.ToTrim(Company.Warrant);
                    txtWarrantDate.Text = SysFun.ToTrim(Company.WarrantDate);
                    txtMemo5.Text = SysFun.ToTrim(Company.memo5);
                   
                    System.Text.StringBuilder strHtml = new System.Text.StringBuilder();
                    if (SysFun.ToTrim(Company.Sort) == "1")
                    {
                        strHtml.Append("<tr>");
                        strHtml.Append("<td class='table_td3'>是否有GSP证书：</td>");
                        strHtml.Append("<td class='table_td2' colspan='3'>");
                        if (Company.IsGsp == "1")
                        {
                            strHtml.Append("<input type='checkbox'  name='chkIsGsp'checked  disabled='disabled' />是");
                        }
                        else
                        {
                            strHtml.Append("<input type='checkbox' name='chkIsGsp' disabled='disabled'  />是");
                        }


                        strHtml.Append("<table  width='98%'border='0' align='center' cellpadding='2' cellspacing='1' class='table_table2'>");
                        strHtml.Append("<tr>");
                        strHtml.Append("<td class='table_td3'>GSP证书：</td>");

                        strHtml.Append("<td class='table_td2'><input type='text' name='txtGspCode' ReadOnly='True' value='" + SysFun.ToTrim(Company.GspCode) + "' size='154px' InvertedComma='GSP或GMP证书'></td>");
                        strHtml.Append("<td class='table_td3'>GSP有效期：</td>");
                        strHtml.Append("<td class='table_td2'><input type='text' name='txtGspDate' ReadOnly='True' value='" + SysFun.ToTrim(Company.GspDate) + "'  size='154px' onclick='javascript:fPopCalendar(this,this);'dataType='Date' format='ymd' require='true' DateTimeOnly='GSP或GMP有效期'></td>");
                        strHtml.Append("</tr><tr>");
                        strHtml.Append("<td class='table_td3'>GSP认证范围</td>");
                        strHtml.Append("<td class='table_td2'><input type='text' name='txtGspRange' ReadOnly='True' value='" + SysFun.ToTrim(Company.GspRange) + "'  size='154px' InvertedComma='GSP或GMP认证范围'></td>");
                        strHtml.Append("<td class='table_td3'>GSP发证时间：</td>");
                        strHtml.Append("<td class='table_td2'><input type='text' name='txtGspPermitDate' ReadOnly='True' value='" + SysFun.ToTrim(Company.GspPermitDate) + "'  size='154px' onclick='javascript:fPopCalendar(this,this);'dataType='Date' format='ymd' require='true' DateTimeOnly='GSP或GMP发证时间'></td>");
                        strHtml.Append("</tr></table></td></tr>");

                    }
                    else
                    {
                       // strHtml.Append("<tr><td class='table_td3'>GMP信息：</td><td class='table_td2' colspan=3><a href='CompanyGMPList.aspx'>GMP信息</a></td></tr>");
                    }
                    labGMP.Text = strHtml.ToString();
                    oo.Dispose();
                    db.Close();
                }
            }
    
}
